<?php

class CommentsController extends AppController
{
	var $name = 'Comments';
	var $uses = array('Comment');
	var $helpers = array('Html', 'Form');
	
	function add()
	{
	$this->checkLock();
		$this->checkLoggedIn();
		$url = $this->webroot . '/strips/index/' . $this->data['Comment']['strip'];

		if(!empty($this->data['Comment']))
		{
			$this->data['Comment']['user_id'] = $this->getUserID();
		
			if($this->Comment->save($this->data['Comment']))
			{
				$this->flash('Your comment has been added.', $url);
			}
			else
			{
				$this->flash('There has been an error adding your comment.', $url);
			}
		}
		else
		{
		    $this->redirect($url);
		}
	}
}

?>
